#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int main()
{
	int arr[6] = { 0 };
	int i = 0;
	int num = 0;
	int max = 0;
	int min = 0;
	int	sz = sizeof(arr) / sizeof(arr[0]);
	for (i = 0; i < sz; i++)
	{
		scanf("%d",&arr[i]);
	}
	for (i = 0; i < sz; i++)
	{
		num += arr[i];
		if (max > arr[i])
		{
			max = arr[i];
		}
		if (min < arr[i])
		{
			min = arr[i];
		}
	}

	printf("%d", (num - max - min) / 4);

}